<!-- USER INFO -->
<script type="text/javascript">
    function show_change_pro_pic(){
        jQuery('#span_file_prof_pic').show();
        jQuery('#btn_show_up_prof_pic').hide();
    }
    function hide_change_pro_pic(){
        jQuery('#span_file_prof_pic').hide();
        jQuery('#btn_show_up_prof_pic').show();
    }
</script>
<div class=framebox_quick_profile style="padding-bottom:20px;border-bottom:solid 5px #00aedb;">
    <dl>
        <?php                                    
            $thumbnail = $this->PhpThumb->generate(
                array(
                    'save_path' => WWW_ROOT . 'img/uploads/Moderators/thumbs',
                    // Where to save the thumbnail. (Make sure it is writable by the web server)

                    'display_path' => 'uploads/Moderators/thumbs',
                    // The web accessible path to the directory that the thumbnail lives in after its created.

                    'error_image_path' => 'img/error.jpg',
                    // The default image to display if something goes wrong while generating a thumbnail. 

                    'src' => WWW_ROOT . "img/uploads/Moderators/" . $access->getmy('image'),
                    // The source image to be converted into a thumbnail.
                    // From here on out, you can pass any standard phpThumb parameters

                    'w' => 165,
                    'h' => 165,
                    'q' => 100,
                    'zc' => 1
                    //'fltr'=>array('ric|4|4')
                )
            );

        ?>        
        <dt>
            <?php echo $this->Html->image($thumbnail['src'], array('width' => $thumbnail['w'], 'height' => $thumbnail['h'])); ?>            
            <input type="button" value="Change Profile Picture" id="btn_show_up_prof_pic" name="btn_show_up_prof_pic" class="btn_show_up_prof_pic" onclick="show_change_pro_pic();"/>
            <form  action="" method="post" id="frm_chg_pic" enctype="multipart/form-data">
                <span id="span_file_prof_pic" name="span_file_prof_pic" style="display:none">
                    <input type="file" name="file_prof_pic" id="file_prof_pic" class="file_prof_pic"/>
                    <input type="submit" class="btn_4prof_pic" name="smt_upload_prof_pic" id="smt_upload_prof_pic" value="Upload"/>
                    <input type="reset" class="btn_4prof_pic" name="rs_upload_prof_pic" id="rs_upload_prof_pic" value="Cancel" onclick="hide_change_pro_pic();"/>
                </span>
            </form>
        </dt>
        <dd>
            <h2><?php echo $get_user_infor['firstname']. ' ' . $get_user_infor['lastname']; ?></h2>
            <table>
                <tr>
                    <td colspan="2" width="30%">Ranks <span blue class=medium>#<?php echo $rank['rank'] ?></span> in points</td>
                    <td width="70%">level: <span blue class=large><?php echo $level ?></span></td>
                </tr>
                <tr>
                    <td width="30%">has <span blue><?php echo $points ?></span> points</td>
                    <td width="30%">rated <span blue><?php echo $subjects_rated ?></span> subjects</td>
                    <td width="30%">added <span blue><?php echo $subject_added ?></span> subjects</td>
                </tr>
                <tr>
                    <td colspan="3">Rating the universe since: March 14, 2011</td>
                </tr>
            </table>
        </dd>
    </dl>
</div>

<div class=clear></div>
<!-- END USER INFO -->

<!-- EDIT PROFILE -->
<div id=edit_profile>

    <article>
        <div class=tab_button_childs>
            <button style=" background:none repeat scroll 0 0 #DDDDDD;height:40px;  margin-left:10px; border-radius: 5px 5px 0 0; width:170px; font-size:14px;  " onclick="user_info()" data-file="frame12">user information</button>
            <button style=" background:none repeat scroll 0 0 #DDDDDD;height:40px;  margin-left:10px; border-radius: 5px 5px 0 0; width:170px;  font-size:14px;    " onclick="about_info()" data-file="frame22">about me</button>
            <button style=" background:none repeat scroll 0 0 #DDDDDD;height:40px;  margin-left:10px; border-radius: 5px 5px 0 0; width:170px;  font-size:14px;  " onclick="subject_info()" data-file="frame32">subjects</button>
        </div>
        <ul class='frame_content_child clearfix'>
            <!-- USER INFORMATION -->
            <li id="user_info" style="display:block;" class=user_info> 
                <form action="" id="user_a" style="display:block" method="post">
                    <table>
                        <tr>
                            <td>First Name</td>
                            <td><input type="text" name="firstname" value="<?php echo $get_user_infor['firstname'] ?>" ></td>
                        </tr>
                        <tr>
                            <td>Last Name</td>
                            <td><input type="text" name="lastname" value="<?php echo $get_user_infor['lastname'] ?>"></td>
                        </tr>
                        <tr>
                            <td>User Name</td>
                            <td><input type="text" name="username" value="<?php if($rank_user->code==1) echo $rank_user->attempt_username ;else echo $get_user_infor['username'] ?>"><span class="error" id="username_dup" name="username_dup" style="color:red"><?php if($rank_user->code==1) echo "Username Exists";?></span></td>
                        </tr>                        
                        <tr>
                            <td>Email</td>
                            <td>
                                <input readonly type="text" name="email" value="<?php echo $get_user_infor['email'] ?>">
                                <small>not shown to public</small>
                            </td>
                        </tr>

                        <tr>
                            <td>Old Password</td>
                            <td><input type="password" name="oldpassword"  value="<?php echo $get_user_infor['password'] ?>"></td>
                        </tr>
                        <tr>
                            <td>New Password</td>
                            <td><input type="password" name="newpassword"  value="<?php echo $get_user_infor['password'] ?>"></td>
                        </tr>
                        <tr>
                            <td>Confirm Password</td>
                            <td><input type="password" name="confirmpassword"  value="<?php echo $get_user_infor['password'] ?>"></td>
                        </tr>
                    </table>

                    <button type="submit"> save </button>
                </form>
            </li>
            <!-- ABOUT ME -->
            <li id="about_info" style="display:block"  class="about_info"  >
                <form  action="" method="post" id="about_a" enctype="multipart/form-data">
                    <blockquote>Disclaimer:  All info entered is private and anonymous. Whatever demographic info you share with us, allows you to view the same demographic data for all subjects on RTU.</blockquote>
                    <table>
                        <thead>
                        <td colspan="2"></td>
                        <td class='smaller' style="text-transform:uppercase;">Hide</td>
                        </thead>
                        <tbody>                    
                            <tr>
                                <td>About Me</td>
                                <td>
                                    <textarea name="About"><?php echo $get_user_infor['About'] ?></textarea>
                                </td>
                                <td>
                                    <input type="checkbox" name="hid_about" id="hid_about" value="1" <?php if($get_user_infor['sts_About']==0) echo 'checked';?>>
                                </td>
                            </tr>
                            <tr>
                                <td>Date of Birth</td>
                                <td>
                                    <select name="month" style="width:100px;">
                                        <?php
                                                for($i=1;$i<=12;$i++)
                                                {
                                        ?>
                                        <option value="<?php echo $i;?>" <?php if($get_user_infor['month'] == $i ) echo "selected";?> > <?php echo $i;?> </option>
                                        <?php
                                                }
                                        ?>
                                    </select>
                                    
                                    <select name="day" style="width:100px;">
                                        <?php
                                                for($i=1;$i<=31;$i++)
                                                {
                                        ?>
                                        <option value="<?php echo $i;?>" <?php if($get_user_infor['day'] == $i ) echo "selected";?> > <?php echo $i;?> </option>
                                        <?php
                                                }
                                        ?>                                        
                                    </select>

                                    <select name="year" style="width:100px;">
                                        <?php
                                            for($i=1900;$i<=2200;$i++)
                                            {
                                        ?>
                                        <option value="<?php echo $i;?>" <?php if($get_user_infor['year'] == $i ) echo "selected";?> > <?php echo $i;?> </option>
                                        <?php
                                            }
                                        ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_dob" id="hid_dob" value="1"></td>
                            </tr>
                            <tr>
                                <td>Gender</td>
                                <td>
                                    <select name="Gender" style="width:200px;">
                                        <?php
                                        $genders = explode(",", $get_subject['Gender']);
                                        $count = 1;
                                        foreach ($genders as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Gender'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php                                         
                                        } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_gender" id="hid_gender" value="1" <?php if($get_user_infor['sts_Gender']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Country</td>
                                <td>
                                    <select name="Country">
                                        <?php
                                        $countries = explode(",", $get_subject['Country']);
                                        $count = 1;
                                        foreach ($countries as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Country'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>									
                                </td>
                                <td><input type="checkbox" name="hid_country" id="hid_country" value="1" <?php if($get_user_infor['sts_Country']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>State</td>
                                <td>
                                    <select name="State" style="width:200px;">
                                        <?php
                                        $states = explode(",", $get_subject['State']);
                                        $count = 1;
                                        foreach ($states as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['State'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_state" id="hid_state" value="1" <?php if($get_user_infor['sts_State']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>City</td>
                                <td>
                                    <select name="City">
                                        <?php
                                        $city = explode(",", $get_subject['City']);
                                        $count = 1;
                                        foreach ($city as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['City'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_city" id="hid_city" value="1" <?php if($get_user_infor['sts_City']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Race</td>
                                <td>
                                    <select name="Race">
                                        <?php
                                        $races = explode(",", $get_subject['Race']);
                                        $count = 1;
                                        foreach ($races as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Race'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_race" id="hid_race" value="1" <?php if($get_user_infor['sts_Race']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Sexual Orientation</td>
                                <td>
                                    <select name="Sexual">
                                        <?php
                                        $sexual = explode(",", $get_subject['Sexual']);
                                        $count = 1;
                                        foreach ($sexual as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Sexual'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_sexual" id="hid_sexual" value="1"<?php if($get_user_infor['sts_Sexual']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Religion</td>
                                <td>
                                    <select name="Religion">
                                        <?php
                                        $religions = explode(",", $get_subject['Religion']);
                                        $count = 1;
                                        foreach ($religions as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Religion'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_religion" id="hid_religion" value="1" <?php if($get_user_infor['sts_Religion']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Martial Status</td>
                                <td>
                                    <select name="Marital">
                                        <?php
                                        $martials = explode(",", $get_subject['Marital']);
                                        $count = 1;
                                        foreach ($martials as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Marital'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_marital" id="hid_marital" value="1" <?php if($get_user_infor['sts_Marital']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Income</td>
                                <td>
                                    <select name="Income">
                                        <?php
                                        $incomes = explode(",", $get_subject['Income']);
                                        $count = 1;
                                        foreach ($incomes as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Income'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_income" id="hid_income" value="1" <?php if($get_user_infor['sts_Income']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Occupation</td>
                                <td>
                                    <select name="Occupation">
                                        <?php
                                        $occupation = explode(",", $get_subject['Occupation']);
                                        $count = 1;
                                        foreach ($occupation as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Occupation'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_occupation" id="hid_occupation" value="1" <?php if($get_user_infor['sts_Occupation']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Education</td>
                                <td>
                                    <select name="Education">
                                        <?php
                                        $educations = explode(",", $get_subject['Education']);
                                        $count = 1;
                                        foreach ($educations as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Education'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>															
                                </td>
                                <td><input type="checkbox" name="hid_education" id="hid_education" value="1" <?php if($get_user_infor['sts_Education']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Pet Owner</td>
                                <td>
                                    <select name="Pet" style="width:100px;">
                                        <?php
                                        $pets = explode(",", $get_subject['Pet']);
                                        $count = 1;
                                        foreach ($pets as $item) {
                                            ?>				
                                            <option value="<?= $count?>" <?php if ($get_user_infor['Pet'] == $count++) echo "selected";?>> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_pet" id="hid_pet" value="1" <?php if($get_user_infor['sts_Pet']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Are You a Parent</td>
                                <td>
                                    <select name="Parent" style="width:100px;">
                                        <?php
                                        $parents = explode(",", $get_subject['Parent']);
                                        $count = 1;
                                        foreach ($parents as $item) {
                                            ?>				
                                            <option  value="<?= $count?>" <?php if ($get_user_infor['Parent'] == $count++) echo "selected";?> value=""> <?php echo $item;?> </option>
                                        <?php } ?>
                                    </select>
                                </td>
                                <td><input type="checkbox" name="hid_parent" id="hid_parent" value="1" <?php if($get_user_infor['sts_Parent']==0) echo 'checked';?>></td>
                            </tr>
                            <tr>
                                <td>Website</td>
                                <td><input type="text" name="Website"  value="<?php echo isset($get_user_infor['Website'])?$get_user_infor['Website']:""; ?>"></td>
                                <td><input type="checkbox" name="hid_website" id="hid_website" value="1" <?php if($get_user_infor['sts_Website']==0) echo 'checked';?>></td>
                            </tr>
                        </tbody>
                    </table>
                    <button type="submit"> save </button>
                </form>
            </li>
            <!-- SUBJECT -->
            <li id="subject_info"  class=subject_info>
                <table class="featured_subject" id="subject_a">
                    <thead>
                        <tr>
                            <td>Featured Subjects</td>
                            <td align="right">
                                <input type="checkbox" name="fs_public" onclick="fs_change_public()" id="fs_public" <?php if($userdetail['User']['public_fs']) echo "checked";?>> public
                                <!-- <a name="fs_btn_public" id="fs_btn_public" onclick="fs_change_public()" style="cursor: pointer; color:#A52A2A">change</a> -->
                            </td>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td width="50%">
                                <table width="100%" id="fs_tbl1" name="fs_tbl1">
                                    <?php
                                        $fs_tbl1 = "";
                                        for($i=0;$i<10&&$i<count($feature_subjects);$i++){
                                            $fs_tbl1 .= "<tr>";
                                            $fs_tbl1 .= "<td>".($i+1)."</td>";
                                            $fs_tbl1 .= "<td>".$feature_subjects[$i]['subject_name']."</td>";
                                            $fs_tbl1 .= "<td>".$feature_subjects[$i]['max_rate']."</td>";
                                            $fs_tbl1 .= "</tr>";
                                        }
                                        echo $fs_tbl1;
                                    ?>
                                </table>
                            </td>
                            <td width="50%">
                                <table width="100%" id="fs_tbl2" name="fs_tbl2">
                                    <?php
                                        $fs_tbl2 = "";
                                        for($i=10;$i<20&&$i<count($feature_subjects);$i++){
                                            $fs_tbl2 .= "<tr>";
                                            $fs_tbl2 .= "<td>".($i+1)."</td>";
                                            $fs_tbl2 .= "<td>".$feature_subjects[$i]['subject_name']."</td>";
                                            $fs_tbl2 .= "<td>".$feature_subjects[$i]['max_rate']."</td>";
                                            $fs_tbl2 .= "</tr>";
                                        }
                                        echo $fs_tbl2;
                                    ?>
                                </table>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <input type="hidden" value="15" id="fs_items_per_page"  name="fs_items_per_page"/>
                <input type="hidden" value='' id="fs_subject_rate"  name="fs_subject_rate"/>
                <input type="hidden" value='<?php echo $fs_check_list;?>' id="fs_check_list"  name="fs_check_list"/> 
                <script type="text/javascript">
                    function fs_search(){
                        var fs_tag1 = jQuery("#fs_tag1").val();
                        var fs_tag2 = jQuery("#fs_tag2").val();
                        var fs_tag3 = jQuery("#fs_tag3").val();
                        var fs_txt  = jQuery("#fs_txt_search").val();
                        var fs_type = jQuery("#fs_type").val();                        
//                        jQuery("#fs_btn_save").removeAttr('disabled');
//                        jQuery("#fs_btn_save").toggleClass( 'save_btn', true );
//                        jQuery("#fs_btn_save").toggleClass( 'save_btn_dis', false );
                        $.ajax({
                            type: 'POST',
                            url: 'fs_search',
                            data: { 
                                    aj_tag1: fs_tag1,
                                    aj_tag2: fs_tag2,
                                    aj_tag3: fs_tag3,
                                    aj_txt: fs_txt
                                    },
                            success: function(data) {
                                // Create pagination element with options
                                var optInit = {callback: fsPageSelectCallback};
                                optInit.items_per_page = jQuery('#fs_items_per_page').val();
                                optInit.num_display_entries = 10;
                                optInit.num_edge_entries = 2;
                                optInit.prev_text = "Prev";
                                optInit.next_text = "Next";       
                                //TEST SERVER DB
                                //alert(data);
                                jQuery("#fs_subject_rate").val(data);
                                var mems = jQuery.parseJSON(data);
                                
                                //refresh the result zone
                                var showed_search_type = "Highest U-Ratings";
                                var showed_tag1 = "";
                                var showed_tag2 = "";
                                var showed_tag3 = "";
                                var showed_txt = "";
                                switch(fs_type){
                                    case 1:
                                        showed_search_type = "Highest U-Ratings";
                                        break;
                                    case 2:
                                        showed_search_type = "Lowest U-Ratings";
                                        break;
                                    case 3:
                                        showed_search_type = "Top number of Votes";
                                        break;
                                    default:
                                        showed_search_type = "Highest U-Ratings";
                                        break;
                                }
                                if(fs_tag1 != "0")
                                    showed_tag1 = ' + "'+fs_tag1+'"';
                                if(fs_tag2 != "0")
                                    showed_tag2 = ' + "'+fs_tag2+'"';
                                if(fs_tag3 != "0")
                                    showed_tag3 = ' + "'+fs_tag3+'"';
                                if(fs_txt != "")
                                    showed_txt = ' + "'+fs_txt+'"';
                                
                                jQuery("#fs_field_show").html('You searched for "' +showed_search_type + showed_tag1 + showed_tag2 + showed_tag3 + showed_txt);
                                jQuery("#fs_result_count").html('Your results: '+ mems.length);
                                
                                jQuery("#fs_pagination").pagination(mems.length, optInit);
                            },
                            dataType: "text"//returned data type
                        });
                    }
                    
                    function fs_save_check(sub_ckb_id){
                        var ckb_id = "fs_check_"+sub_ckb_id;
                        if(jQuery("#"+ckb_id).attr("checked")){
                            var newVal = jQuery("#fs_check_list").val();
                            if(jQuery("#fs_check_list").val() != ""){
                               var fs_check_list2 = jQuery("#fs_check_list").val().slice(0, - 1);
                               var fs_check_list_arr = fs_check_list2.split("|");
                               if(fs_check_list_arr.length>=20){
                                   jQuery("a#fs_reach_limit_popup").trigger('click');
                                   jQuery("#"+ckb_id).attr("checked",false);//set the checkbox back to unchecked 
                                   return;
                               }           
                               if(jQuery.inArray( sub_ckb_id, fs_check_list_arr)<0)
                                   newVal = jQuery("#fs_check_list").val() + sub_ckb_id + "|";                               
                            }
                            else
                                newVal = jQuery("#fs_check_list").val() + sub_ckb_id + "|";
                            jQuery("#fs_check_list").val(newVal);
                        }else{
                            var newVal = jQuery("#fs_check_list").val();
                            if(jQuery("#fs_check_list").val() != ""){
                               var fs_check_list2 = jQuery("#fs_check_list").val().slice(0, - 1);
                               var fs_check_list_arr = fs_check_list2.split("|");
                               var fs_check_list_new = "";
                               var count = 0;
                               for(var i=0;i<fs_check_list_arr.length;i++)
                                   if(fs_check_list_arr[i]!=sub_ckb_id)
                                       fs_check_list_new += fs_check_list_arr[i] +"|";
                               newVal = fs_check_list_new;
                            }
                            jQuery("#fs_check_list").val(newVal);
                        }
                    }
                    
                    function fs_save(){
                        var fs_check_list = jQuery("#fs_check_list").val();
                        if(fs_check_list.length>0) fs_check_list = fs_check_list.slice(0, -1);
//                        jQuery("#fs_btn_save").attr("disabled", "disabled");
//                        jQuery("#fs_btn_save").toggleClass( 'save_btn_dis', true );
//                        jQuery("#fs_btn_save").toggleClass( 'save_btn', false );
                        $.ajax({
                            type: 'POST',
                            url: 'fs_save',
                            data: { 
                                    aj_feature_sub: fs_check_list
                                    },
                            success: function(data) {
//                                var json_data = jQuery.parseJSON( data );
                                var data = data;
                                
                                if(data.result == false)
                                    return;                                
                                jQuery("#fs_check_list").val(data.fs_check_list);
                                if(data.fs_check_list.length > 0){
                                    var fs_check_list2 = data.fs_check_list.slice(0, - 1);
                                    var fs_check_list_arr = fs_check_list2.split("|");                                    
                                    var fs_subject_rate = jQuery.parseJSON( jQuery("#fs_subject_rate").val() );
                                    var count = 0;
                                    var tmp = "";
                                    jQuery("#fs_tbl1").html('');
                                    jQuery("#fs_tbl2").html('');
                                    for(i=0; i<fs_subject_rate.length; i++){
                                        if(jQuery.inArray( fs_subject_rate[i].subject_id, fs_check_list_arr)>-1){
                                            var showed_rate = fs_subject_rate[i].max_rate;
                                            switch(jQuery("#fs_type").val()){
                                                case "1":
                                                    showed_rate = fs_subject_rate[i].max_rate;
                                                    break;
                                                case "2":
                                                    showed_rate = fs_subject_rate[i].min_rate;
                                                    break;
                                                case "3":
                                                    showed_rate = fs_subject_rate[i].frequently;
                                                    break;
                                                default:
                                                    showed_rate = fs_subject_rate[i].max_rate;
                                                    break;
                                            }
                                            
                                            tmp = '<tr>';
                                            tmp += '<td>'+(++count)+'.</td>';
                                            tmp += '<td>'+ fs_subject_rate[i].subject_name +'</td>';
                                            tmp += '<td>'+ showed_rate +'</td>';
                                            tmp += '</tr>';
                                            if(count-1<10){
                                                jQuery("#fs_tbl1").append(tmp);                                                
                                            }                                                
                                            else{
                                                jQuery("#fs_tbl2").append(tmp);                                                
                                            }
                                                
                                        }
                                    }
                                }else{
                                    jQuery("#fs_tbl1").html('');
                                    jQuery("#fs_tbl2").html('');
                                }
                            },
                            dataType: "json"//returned data type
                        });
                    }
                    
                    /**
                    * Callback function that displays the content.
                    *
                    * Gets called every time the user clicks on a pagination link.
                    *
                    * @param {int}page_index New Page index
                    * @param {jQuery} jq the container with the pagination links as a jQuery object
                    */
                    function fsPageSelectCallback(page_index, jq){
                        // Get number of elements per pagionation page from form
                        var items_per_page = $('#fs_items_per_page').val();
                        var newtbl1 = '';
                        var newtbl2 = '';
                        var newtbl3 = '';

                        var json_mems = jQuery("#fs_subject_rate").val();
                        var mems = jQuery.parseJSON(json_mems);

                        var max_elem = Math.min((page_index+1) * items_per_page, mems.length);
                        // Iterate through a selection of the content and build an HTML string
                        var ii = 1;
                        for(var i=page_index*items_per_page;i<max_elem;i++)
                        {
                            var showed_rate = mems[i].max_rate;
                            switch(jQuery("#fs_type").val()){
                                case "1":
                                    showed_rate = mems[i].max_rate;
                                    break;
                                case "2":
                                    showed_rate = mems[i].min_rate;
                                    break;
                                case "3":
                                    showed_rate = mems[i].frequently;
                                    break;
                                default:
                                    showed_rate = mems[i].max_rate;
                                    break;
                            }
                            
                            var fs_check_list_arr = new Array();
                            if(jQuery("#fs_check_list").val() != ""){
                               var fs_check_list2 = jQuery("#fs_check_list").val().slice(0, - 1);
                               var fs_check_list_arr = fs_check_list2.split("|");
                            }
                            var is_checked = "";
                            if(i<=page_index*items_per_page+4){
                                is_checked = "";
                                if(jQuery.inArray( mems[i].subject_id, fs_check_list_arr)>-1)
                                    is_checked = "checked";
                                newtbl1 += '<li>';
                                newtbl1 += '<input class="fs_check" name="fs_check_'+ mems[i].subject_id +'" id="fs_check_'+ mems[i].subject_id +'" type="checkbox" name="" value="'+ mems[i].subject_id +'" onclick="fs_save_check('+ mems[i].subject_id +')" '+is_checked+'>';
                                newtbl1 += '<label for="">';
                                newtbl1 += '<img src="<?php echo $this->webroot ?>img/uploads/Subjects/'+ mems[i].image +'" alt="'+ mems[i].subject_name +' image" width="67" height="96" />';
                                newtbl1 += '<small>'+ mems[i].subject_name +'</small>';
                                newtbl1 += ''+showed_rate;
                                newtbl1 += '</label>';
                                newtbl1 += '</li>';
                            }else if(i<=page_index*items_per_page+9){
                                is_checked = "";
                                if(jQuery.inArray( mems[i].subject_id, fs_check_list_arr)>-1)
                                    is_checked = "checked";
                                newtbl2 += '<li>';
                                newtbl2 += '<input class="fs_check" name="fs_check_'+ mems[i].subject_id +'" id="fs_check_'+ mems[i].subject_id +'" type="checkbox" name="" value="'+ mems[i].subject_id +'" onclick="fs_save_check('+ mems[i].subject_id +')" '+is_checked+'>';
                                newtbl2 += '<label for="">';
                                newtbl2 += '<img src="<?php echo $this->webroot ?>img/uploads/Subjects/'+ mems[i].image +'" alt="'+ mems[i].subject_name +' image" width="67" height="96" />';
                                newtbl2 += '<small>'+mems[i].subject_name +'</small>';
                                newtbl2 += ''+showed_rate;
                                newtbl2 += '</label>';
                                newtbl2 += '</li>';
                            }else{
                                is_checked = "";
                                if(jQuery.inArray( mems[i].subject_id, fs_check_list_arr)>-1)
                                    is_checked = "checked";                                
                                newtbl3 += '<li>';
                                newtbl3 += '<input class="fs_check" name="fs_check_'+ mems[i].subject_id +'" id="fs_check_'+ mems[i].subject_id +'" type="checkbox" name="" value="'+ mems[i].subject_id +'" onclick="fs_save_check('+ mems[i].subject_id +')" '+is_checked+'>';
                                newtbl3 += '<label for="">';
                                newtbl3 += '<img src="<?php echo $this->webroot ?>img/uploads/Subjects/'+ mems[i].image +'" alt="'+ mems[i].subject_name +' image" width="67" height="96" />';
                                newtbl3 += '<small>'+mems[i].subject_name +'</small>';
                                newtbl3 += ''+showed_rate;
                                newtbl3 += '</label>';
                                newtbl3 += '</li>';
                            }
                            ii++;
                        }
                        // Replace old content with new content        
                        jQuery('#fs_result3').html(newtbl3);
                        jQuery('#fs_result2').html(newtbl2);
                        jQuery('#fs_result1').html(newtbl1);

                        // Prevent click eventpropagation
                        return false;
                    }
                    
                    function fs_change_public(){
                        var is_checked = 0;
                        if(jQuery("#fs_public").attr("checked"))
                            is_checked = 1;
                        $.ajax({
                            type: 'POST',
                            url: 'fs_public',
                            data: { 
                                    fs_public: is_checked
                                    },
                            success: function(data) {
//                              
                            },
                            dataType: "text"//returned data type
                        });
                    }
                    
                 $(document).ready(function() { 
                    jQuery("a#fs_reach_limit_popup").fancybox({
                            'titlePosition'	: 'over',
                            'transitionIn'	: 'elastic',
                            'transitionOut'	: 'elastic',
                            'autoDimensions'    : false,
                            'width'             : '300',
                            'height'            : '70'
                    });
                 });
                </script>
                <a href="#fs_reach_limit_cnt" id="fs_reach_limit_popup" style="display:none"></a>
                <div style="display:none;width:auto;height:auto;overflow: auto;position:relative;">                    
                    <div id="fs_reach_limit_cnt">
                        <br/>
                        You have reached your limit of 20 featured subjects. To change featured subject listing, please unselect subjects.
                    </div>
                </div>
                
                <table class=search_subject id="subject_b">
                    <thead>
                    <td colspan="2">
                        <h2>search for subjects you have rated.</h2>
                        <fieldset>
                            <select name="fs_type" id="fs_type" style="width:100px;">
                                <option value="0">Result Type</option>
                                <option value="1">Highest U-Rating Results</option>
                                <option value="2">Lowest U-Rating Results</option>
                                <option value="3">Top number of Votes</option>                                
                            </select>    
                            <select name="fs_tag1" id="fs_tag1" style="width:70px;">
                                <option value="0">Tag</option>
                                <?php  
                                foreach ($all_tags as $tag) {
                                    ?>				
                                    <option  value="<?php echo $tag['Tag']['title'];?>"> <?php echo $tag['Tag']['title'];?> </option>
                                <?php } ?>
                            </select>
                            <select name="fs_tag2" id="fs_tag2" style="width:70px;">
                                <option value="0">Tag</option>
                                <?php  
                                foreach ($all_tags as $tag) {
                                    ?>				
                                    <option  value="<?php echo $tag['Tag']['title'];?>"> <?php echo $tag['Tag']['title'];?> </option>
                                <?php } ?>
                            </select>
                            <select name="fs_tag3" id="fs_tag3" style="width:70px;">
                                <option value="0">Tag</option>
                                <?php  
                                foreach ($all_tags as $tag) {
                                    ?>				
                                    <option  value="<?php echo $tag['Tag']['title'];?>"> <?php echo $tag['Tag']['title'];?> </option>
                                <?php } ?>
                            </select>
                        </fieldset>
                        <input type="search" name="fs_txt_search" id="fs_txt_search" placeholder="Type in keyword" size="28">

                        <button type="button" id="fs_btn_search" name="fs_btn_search" onclick="fs_search()">search</button>

                    </td>
                    </thead>

                    <tbody>
                        <tr>
                            <td><span id="fs_field_show" name="fs_field_show"></span></td>
                            <td align="right"><span id="fs_result_count" name="fs_result_count"></span></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <ul id="fs_result1" name="fs_result1">
                                    
                                </ul>										

                                <ul id="fs_result2" name="fs_result2">
                                    
                                </ul>										

                                <ul id="fs_result3" name="fs_result3">
                                    
                                </ul>										
                            </td>
                        </tr>
                        <tr class="pagination" >
                            <td colspan="2" align="right">
                                <div id="fs_pagination" name="fs_pagination" class="pagination col2 right"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center"><button type="button" class="save_btn" id="fs_btn_save" name="fs_btn_save" onclick="fs_save()">save</button></td>
                        </tr>
                    </tbody>
                </table>
            </li>
        </ul>
    </article>

    <aside id=account_status>
        <form action="" method="post">
            <h1>Account Status: Free</h1>
            <dl>
                <dt>
                <label for=""><input type="radio" name="account" checked value=""> <strong>Free Account</strong></label>

                <h4>Global Account</h4>
                <p>Free 1 week trial at every 500 point level	Free 1 year membership at Galaxy Level Global Membership for life at Black Hole Level</p>

                <ul>
                    <li>Don't need to have any points or vote to view unlimited subject pages (limit of 20 skip ratings per week for free membership).</li>
                    <li>Don't need to share any demographic info to view all subject pages demographic data.</li>
                    <li>Have more filter options when using the Universal Research Tool (URT) and enhanced capabilities for each Subject page Time/U-Ratings graph.</li>
                    <li class=nb>or upgrade immediately</li>
                </ul>
                </dt>
                <dt>
                <label for=""><input type="radio" name="account" value=""> <span blu>$4.99</span> for 1 month</label>
                </dt>
                <dt>
                <label for=""><input type="radio" name="account" value=""> <span blu>$29.99</span> for 1 year</label>

                <h4>Universal Account</h4>
                <p>Free 1 week trial at every 1000 point level.	Free 1 year membership at Black Hole Level.	Universal Membership for life at Supernova Level.</p>

                <ul>
                    <li>Don't need to have any points or vote to view unlimited subject pages (limit of 20 skip ratings per week for free membership).</li>
                    <li>Don't need to share any demographic info to view all subject pages demographic data.</li>
                    <li>Have full use of Universal Research Tool capabilities and full use for Time/U-Ratings graph.</li>
                    <li>Access valuable data available only to Universal members(i.e. total subject votes).</li>
                    <li class=nb>or upgrade immediately</li>
                </ul>
                </dt>
                <dt>
                <label for=""><input type="radio" name="account" value=""> <span blu>$9.99</span> for 1 Month</label>
                </dt>
                <dt>
                <label for=""><input type="radio" name="account" value=""> <span blu>$39.99</span> for 1 Year</label>
                </dt>
                <dd>
                    <p>Click Here to learn more about your <br> account options and features.</p>
                    <img src="<?php echo $this->webroot ?>assets/images/icon_paypal.png" alt="icon_paypal" width="134" height="47" />
                </dd>
            </dl>
        </form>
    </aside>
</div>
<!-- END EDIT PROFILE -->
<script type="text/javascript">
    function user_info()
    {
        document.getElementById('about_info').style.display="none";
        document.getElementById('subject_info').style.display="none";
        document.getElementById('user_info').style.display="block";
        document.getElementById('user_a').style.display="block";
    }
    function about_info()
    {
        document.getElementById('subject_info').style.display="none";
        document.getElementById('user_info').style.display="none";
        document.getElementById('user_a').style.display="none";
        document.getElementById('about_info').style.display="block";
        document.getElementById('about_a').style.display="block";			
    }
    function subject_info()
    {
        document.getElementById('user_info').style.display="none";
        document.getElementById('about_info').style.display="none";
        document.getElementById('about_a').style.display="none";		
        document.getElementById('user_a').style.display="none";
        document.getElementById('subject_info').style.display="block";
        document.getElementById('subject_a').style.display="block";
        document.getElementById('subject_b').style.display="block";
    }
</script>
